home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr27 / mdate100.zip / MDATE.PAS < prev    next >
Pascal/Delphi Source File  |  1995-02-24  |  1KB  |  48 lines

  1. program match_file_dates_and_times;
  2. {$M 1024,0,0} {minimize stack and heap}
  3. {$I-} {disable I/O checking - trap I/O errors by checking IOResult}
  4. uses dos;
  5.  
  6. procedure showhelp(const problem :byte);
  7. (* If any *foreseen* errors arise, we are sent here to
  8.    give a little help and exit (relatively) peacefully *)
  9. const
  10.   progdesc = 'MatchDate v1.00 - Free DOS utility: file date & time matcher.';
  11.   author   = '(c) February 24, 1995, by David Daniel Anderson - Reign Ware.';
  12.   usage    = 'Usage:  MDate control_file change_file   (DOS wildcards are NOT permitted)';
  13. var
  14.   message : string[70];
  15. begin
  16.   writeln(progdesc);
  17.   writeln(author);    writeln;
  18.   writeln(usage);     writeln;
  19.   if problem > 0 then begin
  20.     case problem of
  21.       1 : message := 'Unexpected file error - make sure both files exist.';
  22.     else  message := 'Unanticipated error of unknown type.';
  23.     end;
  24.     writeln (#7,message);
  25.   end;
  26.   halt(problem)
  27. end;
  28.  
  29. procedure iocheck(const iores :byte);
  30. begin
  31.   if iores <> 0 then showhelp(1);
  32. end;
  33.  
  34. var
  35.    p1, p2 : pathstr;
  36.    master, change : file;
  37.    fdt  : longint;
  38.  
  39. begin
  40.   if paramcount <> 2 then showhelp (0);
  41.   p1 := paramstr(1); p2 := paramstr(2);
  42.   assign (master, p1); reset (master); iocheck(ioresult);
  43.   assign (change, p2); reset (change); iocheck(ioresult);
  44.   getftime (master, fdt); setftime (change, fdt);
  45.   close (master); close (change);
  46.   Writeln('Matched date and time of "',p2,'" to "',p1,'".');
  47. end.
  48.